const Controller = require('egg').Controller

class post extends Controller {
  /**
   * /posts
   */
  async index () {
    this.ctx.body = 'get index';
  }
  /**
   * /posts/new
   */
  async new () {
    this.ctx.body = 'get new method!';
  }
  /**
   * /posts/12
   */
  async show () {
    const {ctx} = this
    ctx.body = `get show. id: ${ctx.params.id}`;
  }
  /**
   * /posts/12/edit
   */
  async edit () {
    const {ctx} = this
    ctx.body = `get edit /posts/:id/edit. id: ${ctx.params.id}`;
  }
  /**
   * POST
   * /posts/
   */
  async create () {
    this.ctx.body = 'post posts.';
  }
 
  /**
  * PUT
  * /posts/:id 
  */
  async update() {
    this.ctx.body = `put posts.`;
  }
  /**
   * DELETE
   * /post/:id
   */
  async destory () {
    this.ctx.body = `delete posts`
  }
}

module.exports = post

// exports.index = async () => {
//   this.ctx.body = 'get index';
// };